<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jq/jquery-1.11.0.min.js"></script>
</head>

<body>
    <form action="" id="form1">
        <input type="text" name="uname">
        <input type="password" name="password">
        <button type="submit">
            提交
        </button>
    </form>
    <script>
        // serialize()函数 一次性获取表单里所有数据
        // 表单里必须有name属性才可使用该函数 
        $(function () {
            $('#form1').on('submit', function (e) {

                e.preventDefault()
                console.log($(this).serialize());
            })
        })
    </script>
</body>

</html>